<?php
include ("../includes/config_conexao.php");

$idServico = $_POST["idServico"];
$idPeca = $_POST["idPeca"];
$qtdPeca = $_POST["qtdPeca"];
$vlrTotal = $_POST["vlrTotal"];
$vlrDesc = $_POST["vlrDesc"];

$r = mysql_query("select vlr_servico,vlr_desc_servico from servico where id_servico = ".$idServico);
$rr = mysql_fetch_array($r);

$vT = $rr["vlr_servico"] - $vlrTotal;
$vD = $rr["vlr_desc_servico"] - $vlrDesc;

$resposta = mysql_query("update servico set vlr_servico = '".$vT."', vlr_desc_servico = '".$vD."' 
						where id_Servico = ".$idServico);

$resposta = mysql_query("update atendimento set vlr_atendimento = '".$vT."' 
						where id_Servico = ".$idServico);

$resposta = mysql_query( "delete from movimento_peca where id_servico = ".$idServico." and id_peca = ".$idPeca );
echo $resposta;

?>